import jdk.internal.org.objectweb.asm.commons.SerialVersionUIDAdder;
import java.lang.String;
import java.io.*;
import java.net.URL;
import java.util.*;

/**
 * @author ：Dsi
 * @date ：2021/11/17 8:48
 * Describe ：<img src="/uploads/allimg/210317/001935-16159115757f04.jpg" alt
 * ="猫羽雫 蓝色眼睛女子 尾巴 女孩子 猫耳 猫 可爱二次元动漫4k壁纸">
 */
public class Test implements Serializable {

    public static void main(String[] args)  throws Throwable {
        GetSourceCode();
        AnalyzeSourceCode(GetSourceCode());
        setCollection();
        SetPicter();
    }

    private static void SetPicter() throws Throwable {
        List<String> set=setCollection();

    }

    private static List<String> setCollection() throws Throwable {
        List<String> set=AnalyzeSourceCode(GetSourceCode());
        List<String> get=new ArrayList<>();
        String s="https://pic.netbian.com/";
        for (int j = 0; j < set.size(); j++) {
            get.add(s+set.get(j));
        }
        System.out.println(get);
        return get;
    }

    public static List<String> AnalyzeSourceCode(String[] a) {
        String a1=Arrays.toString(a);
        String[] out = a1.split("<img");
        List<String> c=new ArrayList<>();
        String regex="/uploads/allimg";
        for (String s: out
             ) {
            if(s.contains("src=\"/uploads/allimg")){
                    c.add(s);
                }
            }

        List<String> c1=new ArrayList<>();
        for (String s1:c
             ) {
            int b=s1.indexOf("/");
            int b2=s1.indexOf(".jpg");
            c1.add(s1.substring(b,b2+4));
        }
        System.out.println(c1);
        Iterator<String> str = c1.iterator();

        return c1;
    }

    private static String[] GetSourceCode() throws Throwable {
        String b = "https://pic.netbian.com/4kdongman/";
        URL u=new URL(b);
        InputStream i = u.openStream();
        byte[] bytes=new byte[1024*10];
        String[] bos=new String[10];
        for (int j = 0; (i.read(bytes))!=-1; j++) {
            bos[j]=new String(bytes,0,bytes.length);
        }
        i.close();
        return bos;
    }
}
